package com.example.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.po.LeoTest1;
import com.example.mapper.LeoTest1Mapper;
import com.example.service.LeoTest1Service;
import org.springframework.stereotype.Service;

/**
* @author admin
* @description 针对表【leo_test_1】的数据库操作Service实现
* @createDate 2024-12-06 10:24:24
*/
@Service
public class LeoTest1ServiceImpl extends ServiceImpl<LeoTest1Mapper, LeoTest1>
    implements LeoTest1Service {

    @Override
    @DS("dev")
    public LeoTest1 findDevData() {
        return this.baseMapper.selectById(1L);
    }

    @Override
    @DS("test")
    public LeoTest1 findTestData() {
        return this.baseMapper.selectById(1L);
    }

    @Override
    @DS("hologres")
    public int executeSql(String operation, String sql) {
        if ("添加".equals(operation)){
            return this.baseMapper.insertData(sql);
        } else if ("更新".equals(operation)){
            return this.baseMapper.updateData(sql);
        } else if ("删除".equals(operation)){
            return this.baseMapper.deleteData(sql);
        }
        return -1;
    }

    @Override
    @DS("hologres")
    public LeoTest1 findHoloData() {
        return this.baseMapper.selectById(1L);
    }

}




